<template>
  <div class="article-page mx-auto max-w-7xl">
    <div class="box flexbox">
      <!-- v-sticky="{ zIndex: 2,stickyTop: 0 }" -->
      <div class="left-tab sticky top-[8rem] h-fit">
        <div class="title flexbox flex-align-center">
          <img
            loading="lazy"
            class="icon"
            v-if="category.icon"
            v-lazy="$globalFn.imgPrefixUrl(category.icon)"
            :title="category.name"
            :alt="category.name"
          />
          <span class="name">{{ category.name || '' }}</span>
        </div>
        <div class="list pc-list">
          <nuxt-link
            :class="[
              'item flexbox flex-align-center flex-justify-between hovdrs',
              tabId == item.code ? 'text-red-600 selectbackground' : 'text-[#999999]'
            ]"
            v-for="item in tabList"
            :key="item.code"
            :to="localePath(`/article/${item.code}`)"
          >
            <div class="left flexbox flex-align-center">
              <!-- <img class="icon" v-lazy="item.icon" alt="" srcset=""> -->
              <span class="text">{{ item.title }}</span>
            </div>
          </nuxt-link>
        </div>
        <div class="list mobile-list">
          <div class="line"></div>
          <div class="tabs flexbox flex-align-center">
            <nuxt-link
              :class="['tab', tabId == item.code ? 'active' : '']"
              v-for="item in tabList"
              :key="item.code"
              :to="localePath(`/article/${item.code}`)"
            >
              {{ item.title }}
            </nuxt-link>
          </div>
        </div>
      </div>
      <div class="right-con" v-if="info.code">
        <div class="tab-cont">
          <div class="title">
            <div class="fleflex flexbox flex-align-center flex-justify-betweenlex-row flex-row">
              <h1 class="name">{{ info.title }}</h1>
            </div>
          </div>
          <div class="cont" v-if="info.content">
            <div class="item">
              <div class="simditor">
                <div class="simditor-body">
                  <div v-html="info.content"></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- <no-data v-if="tabList.length==0"></no-data> -->
    </div>
  </div>
</template>
<script>
  export default {
    layout: 'newsHome',
    name: 'terms-of-use',
    head: {
      title: 'Terms of Use - SEALMG',
      meta: [
        {
          hid: 'description',
          name: 'description',
          content: "Review SEALMG's Terms of Use for game top-ups, gift cards, and digital credits to ensure a secure experience."
        }
      ]
    },
    data() {
      return {
        tabId: 'terms-of-use',
        tabList: [],
        category: {},
        info: {}
      }
    },
    computed: {},
    mounted() {
      this.getArticle()
    },
    methods: {
      // 获取文章
      getArticle() {
        this.$axios.get(`/api/cms.article/readAndList?code=${this.tabId}`).then(res => {
          this.tabList = res.list || []
          this.category = res.category || {}
          this.info = res.info || {}
          // if (this.tabId == "" && this.tabList.length) {
          //   this.info = this.tabList[0];
          //   this.tabId = this.info.code;
          // }
        })
      },
      // 切换文章
      changeTab(item) {
        return this.localePath(`/article/${item.code}`)
      }
    }
  }
</script>
<style lang="less" scoped>
  // @import "~/assets/css/simditor.css";
  .hovdrs:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #efefef 100%);
    border-radius: 0 32px 32px 0;
    // color: #ff4e33 !important;
    @apply duration-300 transition-colors;
  }
  .selectbackground {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #ffebe5 100%) !important;
    border-radius: 0 32px 32px 0;
    color: #ff4e33 !important;
  }
  .article-page {
    .box {
      margin-top: 20px;
    }
    .left-tab {
      position: sticky;
      top: 96px;
      z-index: 1;
      width: 387px;
      .title {
        padding: 16px;
        .icon {
          width: 24px;
          height: 24px;
          margin-right: 8px;
        }
        .name {
          font-weight: 600;
          font-size: 16px;
          color: @font-color-26;
        }
      }
      .list {
        .item {
          box-sizing: border-box;
          padding: 0 16px;
          width: 336px;
          height: 48px;
          cursor: pointer;
          .left {
            .icon {
              width: 16px;
              height: 16px;
              margin-right: 8px;
            }
            .text {
              font-weight: 500;
              font-size: 14px;
              color: @font-color-66;
            }
          }
        }
        .item.active {
          background: @input-focus-bg;
          border-radius: 8px;
        }
      }
      .pc-list {
        display: block;
      }
      .mobile-list {
        display: none;
      }
    }
    .right-con {
      flex: 1;
      margin-left: 20px;
      .tab-cont {
        width: 100%;
        .title {
          box-sizing: border-box;
          padding: 20px 24px 12px 24px;
          .row {
            padding-bottom: 8px;
            border-bottom: @border-1-fo;
          }
          .name {
            font-weight: 500;
            font-size: 22px;
            color: @font-color-14;
          }
          .btn {
            box-sizing: border-box;
            padding: 0;
            width: 58px;
            height: 32px;
            line-height: 32px;
            font-size: 16px;
            text-align: center;
            color: @font-color-26;
            border-radius: 25px;
            border: none;
          }
        }
        .cont {
          padding: 20px 24px;
          .item {
            margin-bottom: 32px;
            .item-title {
              margin-bottom: 8px;
              font-weight: 500;
              font-size: 16px;
              color: @font-color-26;
            }
            .item-desc {
              font-weight: 500;
              font-size: 14px;
              color: @font-color-66;
            }
          }
        }
      }
    }
  }
  @media only screen and (min-width: 1200px) {
  }
  @media screen and (max-width: 992px) and (min-width: 768px) {
    .article-page {
      .box {
        margin-top: 0px;
        width: 100%;
        display: block;
      }
      .left-tab {
        width: 100%;
        top: 88px;
        z-index: 11;
        background: #fff;
        .title {
          padding: 16px;
          .icon {
            display: none;
          }
          .name {
            font-weight: 500;
            font-size: 20px;
            color: @font-color-14;
          }
        }
        .pc-list {
          display: none;
        }
        .mobile-list {
          display: block;
          padding: 0 16px;
          .line {
            width: 100%;
            height: 1px;
            margin-top: -8px;
            background: @color-e5;
          }
          .tabs {
            margin-top: 16px;
            width: 100%;
            overflow-x: auto;
            height: 36px;
            .tab {
              margin-right: 24px;
              font-size: 14px;
              color: @font-color-99;
              flex-shrink: 0;
            }
            .tab.active {
              font-weight: 500;
              color: @theme-color;
            }
          }
        }
      }
      .right-con {
        flex: 1;
        margin-left: 0px;
        .tab-cont {
          width: 100%;
          .title {
            display: none;
          }
          .cont {
            padding: 16px;
            .item {
              margin-bottom: 32px;
            }
          }
        }
      }
    }
  }
  @media screen and (max-width: 767px) {
    .article-page {
      .box {
        margin-top: 0px;
        width: 100%;
        display: block;
      }
      .left-tab {
        width: 100%;
        top: 88px;
        z-index: 11;
        background: #fff;
        .title {
          padding: 16px;
          .icon {
            display: none;
          }
          .name {
            font-weight: 500;
            font-size: 20px;
            color: @font-color-14;
          }
        }
        .pc-list {
          display: none;
        }
        .mobile-list {
          display: block;
          padding: 0 16px;
          .line {
            width: 100%;
            height: 1px;
            margin-top: -8px;
            background: @color-e5;
          }
          .tabs {
            margin-top: 16px;
            width: 100%;
            overflow-x: auto;
            height: 36px;
            .tab {
              margin-right: 24px;
              font-size: 14px;
              color: @font-color-99;
              flex-shrink: 0;
            }
            .tab.active {
              font-weight: 500;
              color: @theme-color;
            }
          }
        }
      }
      .right-con {
        flex: 1;
        margin-left: 0px;
        .tab-cont {
          width: 100%;
          .title {
            display: none;
          }
          .cont {
            padding: 16px;
            .item {
              margin-bottom: 32px;
            }
          }
        }
      }
    }
  }
</style>
